import javax.sql.rowset.serial.SerialStruct;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mac
 * Date: 2023-03-17
 * Time: 11:52
 */
public class Day22 {
    //11.盛最多水的容器
    public static int maxArea(int[] height) {
        if (height.length <= 1) return -1;
        int i = 0, j = height.length - 1, ret = 0;
        while ( i < j){
            int h = Math.min(height[i], height[j]);
            ret = Math.max(ret, h * (j - 1));
            if (height[i] < height[j]){
                i++;
            }else{
                j--;
            }
        }
        return ret;
    }
    //12.整数转罗马数字
    public String intToRoman(int num) {
        int[] ret = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
        String[] cnt = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 13; i++) {
            while (num >= ret[i]){
                num -= ret[i];
                sb.append(cnt[i]);
            }
        }
        return sb.toString();
    }

    //
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String str1 = scanner.nextLine();
        String str2 = scanner.nextLine();

        char[] sc = str1.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < sc.length; i++) {
            if (!str2.contains(sc[i]+"")){
                sb.append(sc[i]);
            }
        }

        System.out.println(sb.toString());
    }

    //14.最长公共前缀
    public String longestCommonPrefix1(String[] strs) {
        if (strs.length == 1){
            return strs[0];
        }
        StringBuilder sb = new StringBuilder();

        char[] ret = strs[0].toCharArray();
        for (int i = 0; i < ret.length; i++) {
            int j = 0;

            for (j = 1; j < strs.length; j++) {
                if (i > strs[j].length() || i < strs[j].length() && strs[j].charAt(i) != ret[i]){
                    return sb.toString();
                }
            }
            sb.append(ret[i]);
        }
        return sb.toString();
    }
    //怪物啊 -- startWith()方法
    public String longestCommonPrefix(String[] strs) {
        if(strs.length==0)return "";
        //公共前缀比所有字符串都短，随便选一个先
        String s=strs[0];
        for (String string : strs) {
            while(!string.startsWith(s)){
                if(s.length()==0)return "";
                //公共前缀不匹配就让它变短！
                s=s.substring(0,s.length()-1);
            }
        }
        return s;
    }

    //倒置字符串
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String str = scanner.nextLine();
        StringBuilder sb = new StringBuilder(str);

        sb.reverse();
        String[] ss = sb.toString().split(" ");
        StringBuilder answer = new StringBuilder();
        for (int i = 0; i < ss.length; i++) {
            StringBuilder ret = new StringBuilder(ss[i]);
            ret.reverse();
            answer.append(ret + " ");
        }

        System.out.println(answer.toString());
    }

    //15.三数之和
    public List<List<Integer>> threeSum(int[] nums) {
        List<Integer> list = new ArrayList<>();

        for (int i = 0; i < nums.length; i++) {

        }
        return null;
    }

    public static void main(String[] args) {
    }
}
